package tgc.edu.demo.jkxt.entity;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import tgc.edu.demo.jkxt.custom.BaseEntity;

@Entity
@Table(name = "question")
public class Question extends BaseEntity<Integer>{
	private String timu;
	private String answer;
	private List<Xuanxaing> xuanxiang;
	private Integer type;
	private Knowledge zhishi;

	@ManyToOne
	public Knowledge getZhishi() {
		return zhishi;
	}
	public void setZhishi(Knowledge zhishi) {
		this.zhishi = zhishi;
	}
	
	@Column(name = "timu", nullable = false,columnDefinition="varchar(5000)")
	public String getTimu() {
		return timu;
	}
	public void setTimu(String timu) {
		this.timu = timu;
	}

	public String getAnswer() {
		return answer;
	}
	public void setAnswer(String answer) {
		this.answer = answer;
	}
	@ManyToMany(cascade = CascadeType.REFRESH ,fetch = FetchType.EAGER)
	@JoinTable(name = "question_xuanxiang",joinColumns = {@JoinColumn(name="question_id")},inverseJoinColumns = {@JoinColumn(name="xuanxiang_id")})
	public List<Xuanxaing> getXuanxiang() {
		return xuanxiang;
	}
	public void setXuanxiang(List<Xuanxaing> xuanxiang) {
		this.xuanxiang = xuanxiang;
	}
	
	
	
	public Integer getType() {
		return type;
	}
	public void setType(Integer type) {
		this.type = type;
	}
	
	
	

	@Override
	public String toString() {
		return "Question [timu=" + timu + ", answer=" + answer + ",  xuanxiang=" + xuanxiang + ", type=" + type + "]";
	}
	public Question() {
		super();
	}
	public Question(Integer id) {
		super(id);
	}
}
